package com.kiss.fw.servlets;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.kiss.fw.utils.Util;

public abstract class AbstractStartupServlet extends AbstractServlet {
	private static final Logger logger = Logger.getLogger(AbstractStartupServlet.class);
	
	protected abstract void startup() throws Exception;
	
	@Override
	protected final void initialize() throws Exception {
		// putting the startup script in a try/catch block because
		// startup exception should not be logged ot the console,
		// which would occur since the AbstractServlet throws a
		// ServletException when the initialize() method fails.
		try {
			startup();
		}
		catch(Exception _exception) {
			Util.handleException(logger, "Error in Startup Servlet", _exception);
		}
	}
	
	@Override
	protected final void executeDelete(HttpServletRequest _request, HttpServletResponse _response) throws Exception {
	}
	
	@Override
	protected final  void executeGet(HttpServletRequest _request, HttpServletResponse _response) throws Exception {
	}
	
	@Override
	protected final  void executeHead(HttpServletRequest _request, HttpServletResponse _response) throws Exception {
	}
	
	@Override
	protected final  void executeOptions(HttpServletRequest _request, HttpServletResponse _response) throws Exception {
	}
	
	@Override
	protected final  void executePost(HttpServletRequest _request, HttpServletResponse _response) throws Exception {
	}
	
	@Override
	protected final  void executePut(HttpServletRequest _request, HttpServletResponse _response) throws Exception {
	}
	
	@Override
	protected final  void executeTrace(HttpServletRequest _request, HttpServletResponse _response) throws Exception {
	}
}